//
// GPSMapEdit
// (c) Konstantin Galichsky (kg@geopainting.com), 2003-2007
//
// Holux type set.
//

# include "StdAfx.h"
# include "Resource.h"
# include "HoluxTypes.h"
# include "HoluxRound.h"
# include "Map.h"
# include "GarminTypes.h"
# include "NavitelTypes.h"
# include "RussaTypes.h"
# include "TypesPOIDraw.h"
# include "Types.h"
# include "TypeLocalization.h"
# include "TypesDraw.h"
# include "fvector.h"
# include "Globals.h"

bool Holux_IsCity (const rgn_t & _rgn) {
	return 40 <= _rgn.ushType && _rgn.ushType <= 42;
}

bool Holux_IsRoad (const rgn_t & _rgn) {
	return 4 <= _rgn.ushType && _rgn.ushType <= 6;
}

BYTE HoluxType2IndexType (BYTE _btHoluxType) {
	// NOTE: the types 'Highway' and 'Road' should be indexed as 'Street'.
	if (_btHoluxType == 4 || _btHoluxType == 5)
		return 6;
	// NOTE: the types 'Big city' and 'City' should be indexed as 'Middle city'.
	if (_btHoluxType == 40 || _btHoluxType == 42)
		return 41;
	return _btHoluxType;
}

static HCURSOR g_hcurNature;

static HPEN g_hpen43;
static HPEN g_hpen44;
static HPEN g_hpen45;
static HPEN g_hpen46;
static HPEN g_hpen46_2;
static HPEN g_hpen47;
static HPEN g_hpen48;
static HPEN g_hpen48_2;

struct POI_desc_t {
	BYTE btPointCode;
	BYTE btCategory;

	char * strTypeName;

		// The icon for point/POI. NOTE: can't be NULL; use g_hcurUnknown for default.
	HCURSOR *      phCursor;

	label_desc_t * pLabelDesc;
};

static POI_desc_t g_POIs [] = {
	{7,    catAviation,      "Airport",         & g_hcurAirport},
	{8,    catEmrgGov,       "Government",      & g_hcurPublic},
	{9,    catAuto,          "Gas station",     & g_hcurPetrol},
	{10,   catLodging,       "Hotel",           & g_hcurHotel},
	{11,   catEmrgGov,       "Hospital",        & g_hcurHospital},
	{12,   catSports,        "Sports",          & g_hcurSports},
	{13,   catRecreation,    "Scenic",          & g_hcurScenic},
	{14,   catShopping,      "Shopping",        & g_hcurDepartmentStore},
	{15,   catServices,      "Bank",            & g_hcurBank},
	{16,   catEducation,     "School",          & g_hcurSchool},
	{17,   catAuto,          "Parking",         & g_hcurParking},
	{18,   catTransport,     "Station",         & g_hcurBusStation},
	{19,   catMarine,        "Marina",          & g_hcurWharf},
	{20,   catOthers,        "Other",           & g_hcurUnknown},
	{22,   catManMade,       "Dam",             & g_hcurDam},
	{23,   catRecreation,    "Nature",          & g_hcurNature},    // Harbor ?
	{24,   catEmrgGov,       "Police",          & g_hcurPolice},
	{25,   catAuto,          "Car service",     & g_hcurAutoRepair},
	{26,   catFood,          "Restaurant",      & g_hcurDining},
	{27,   catTransport,     "Railway station", & g_hcurStation},
	{28,   catRecreation,    "Camping",         & g_hcurCamping},
	{29,   catRecreation,    "Recreation",      & g_hcurAmusementPark},
	{30,   catRecreation,    "Park",            & g_hcurPark},
	{31,   catEntertainment, "Culture",         & g_hcurCulture},
	{32,   catReligion,      "Religion",        & g_hcurChurch},
	{33,   catManMade,       "Building",        & g_hcurBuilding},
	{34,   catManMade,       "Monument",        & g_hcurMonument},
	{35,   catTransport,     "Cable car",       & g_hcurCableCar},
	{36,   catLand,          "Mountain pass",   & g_hcurPassing},

	{40,   catCities,        "Big city",        & g_hcurCityBig,    & g_BigCityLabel},
	{41,   catCities,        "Middle city",     & g_hcurCityMedium, & g_CityLabel},
	{42,   catCities,        "City",            & g_hcurCitySmall},

	{52,   catRecreation,    "Bike",            & g_hcurUnknown},
	{53,   catMarineNavaids, "Buoy",            & g_hcurNavaid},
	{54,   catRecreation,    "Fish",            & g_hcurFish},
	{55,   catSports,        "Horse",           & g_hcurUnknown},
	{56,   catRecreation,    "Man",             & g_hcurTrailHead},
	{57,   catMarineNavaids, "Beacon",          & g_hcurNavaid},
	{58,   catMarine,        "Anchorage",       & g_hcurWharf},
};

///////////////////////////////////////////////////////////////

struct polyline_desc_t {
	BYTE btCode;
	BYTE btCategory;

	char * strTypeName;

		// The pens to draw polylines.
	HPEN *         phPen;
		// The pen for second pass. NOTE: NULL means not to draw 2nd pass.
	HPEN *         phPen2;

	label_desc_t * pLabelDesc;
};

static polyline_desc_t g_Polylines [] = {
	{4,  catRoads,      "Highway",       & g_hpenHighway1,     & g_hpenHighway2,     & g_RoadLabel},
	{5,  catRoads,      "Road",          & g_hpenPrincipalHw,  NULL,                 & g_RoadLabel},
	{6,  catRoads,      "Street",        & g_hpenThinRoad,     NULL,                 & g_RoadLabel},

	{43, catOthers,     "Line style 1",  & g_hpen43,           NULL,                 & g_RoadLabel},
	{44, catOthers,     "Line style 2",  & g_hpen44,           NULL,                 & g_RoadLabel},
	{45, catOthers,     "Line style 3",  & g_hpen45,           NULL,                 & g_RoadLabel},
	{46, catOthers,     "Line style 4",  & g_hpen46,           & g_hpen46_2,         & g_RoadLabel},
	{47, catOthers,     "Line style 5",  & g_hpen47,           NULL,                 & g_RoadLabel},
	{48, catOthers,     "Line style 6",  & g_hpen48,           & g_hpen48_2,         & g_RoadLabel},

	{50, catRoads,      "Rail road",     & g_hpenRailroad1,    & g_hpenRailroad2,    & g_DefLabel},
	{51, catBoundaries, "Border",        & g_hpenBoundaryInt1, & g_hpenBoundaryInt2, & g_BoundaryLabel},
};

///////////////////////////////////////////////////////////////

struct polygon_desc_t {
	BYTE btCode;
	BYTE btCategory;

	char * strTypeName;

		// The brush to fill polygons.
	HBRUSH *       phBrush;
		// The pen to draw border.
	HPEN *         phPen;

	label_desc_t * pLabelDesc;
};

static polygon_desc_t g_Polygons [] = {
	{0, catCities, "Urban area", & g_hbrSmallUrbanHousing, & g_hpenNull},
	{1, catWater,  "Water area", & g_hbrWater,             & g_hpenCoast, & g_RiverLabel},
	{2, catLand,   "Vegetation", & g_hbrForest,            & g_hpenNull},
	{3, catOthers, "Other",      & g_hbrUnknown,           & g_hpenUnknown},
};

static fvector<type_desc_t> g_types_impl;

static
void InitHoluxTypes () {
	//
	// Prepare Holux-specific POI icons.
	//

	g_hcurNature   = ::LoadCursor (g_hInst, MAKEINTRESOURCE (IDC_Land));

	g_hpen43   = ::CreatePen (PS_SOLID, 1, c_colLtGray);
	g_hpen44   = ::CreatePen (PS_DASH,  1, c_colLtGray);
	g_hpen45   = ::CreatePen (PS_DASH,  1, c_colBlack);
	g_hpen46   = ::CreatePen (PS_SOLID, 3, c_colBlack);
	g_hpen46_2 = ::CreatePen (PS_DOT,   1, c_colWhite);
	g_hpen47   = ::CreatePen (PS_SOLID, 3, c_colDkGray);
	g_hpen48   = ::CreatePen (PS_SOLID, 3, c_colBlack);
	g_hpen48_2 = ::CreatePen (PS_SOLID, 1, c_colLtGray);

	//
	//
	//
	g_types_impl.push_back (g_tdUnknown);

	// Prepare POIs.
	size_t cPOI;
	for (cPOI = 0; cPOI < sizeof (g_POIs)/sizeof (g_POIs [0]); ++ cPOI) {
		const POI_desc_t & d = g_POIs [cPOI];

		g_types_impl.push_back (type_desc_t ());
		type_desc_t & td = g_types_impl.back ();

		td.ushType        = d.btPointCode;
		td.Kind           = rkPoint;
		td.ulType2        = td.ulType;
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phCursor       = d.phCursor;
		td.phBrush        = NULL;
		td.phPen          = NULL;
		td.phPen2         = NULL;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_DefLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Prepare polylines.
	for (size_t cPolyline = 0; cPolyline < sizeof (g_Polylines)/sizeof (g_Polylines [0]); ++ cPolyline) {
		const polyline_desc_t & d = g_Polylines [cPolyline];

		g_types_impl.push_back (type_desc_t ());
		type_desc_t & td = g_types_impl.back ();

		td.ushType        = d.btCode;
		td.Kind           = rkPolyline;
		td.ulType2        = td.ulType;
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phCursor       = NULL;
		td.phBrush        = NULL;
		td.phPen          = d.phPen;
		td.phPen2         = d.phPen2;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_DefLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Prepare polygons.
	for (size_t cPolygon = 0; cPolygon < sizeof (g_Polygons)/sizeof (g_Polygons [0]); ++ cPolygon) {
		const polygon_desc_t & d = g_Polygons [cPolygon];

		g_types_impl.push_back (type_desc_t ());
		type_desc_t & td = g_types_impl.back ();

		td.ushType        = d.btCode;
		td.Kind           = rkPolygon;
		td.ulType2        = td.ulType;
		td.Category       = static_cast<type_category_t> (d.btCategory);

		td.strTypeName    = d.strTypeName;
		td.phCursor       = NULL;
		td.phBrush        = d.phBrush;
		td.phPen          = d.phPen;
		td.phPen2         = NULL;

		const label_desc_t * const pLD = d.pLabelDesc ? d.pLabelDesc : & g_CenteredLabel;
		td.phFont         = pLD->phFont;
		td.colText        = pLD->colText;
		td.pfPrepareLabel = pLD->pfPrepareLabel;
		td.pfDrawLabel    = pLD->pfDrawLabel;
	}

	// Make sure all types are sorted by code (as required by GetTypeDesc()).
	std::sort (g_types_impl.begin (), g_types_impl.end ());

	// NOTE: here is assumed that STL stores vector as plain array.
	g_tsHolux.pTypes           = & g_types_impl [0];
	g_tsHolux.cTypes           = g_types_impl.size ();

	g_tsHolux.strID            = "Holux";
	g_tsHolux.strDisplayName   = "ALAN Map x00 / Holux";

	g_tsHolux.pfGetLatGrid     = HoluxLatGrid;
	g_tsHolux.pfRoundPoint     = HoluxRoundPoint;
	g_tsHolux.pfRoundPoints    = HoluxRoundPoints;
	g_tsHolux.pfRoundRect      = HoluxRoundRect;

	g_tsHolux.pfIsCity         = Holux_IsCity;
	g_tsHolux.pfIsHwExit       = RgnPredicateFalse;
	g_tsHolux.pfIsRoad         = Holux_IsRoad;
	g_tsHolux.pfIsUnpavedRoad  = RgnPredicateFalse;
	g_tsHolux.pfIsBackground   = RgnPredicateFalse;
	g_tsHolux.pfHasAddress     = RgnPredicateFalse;
	g_tsHolux.pfHasCityAndZip  = RgnPredicateTrue;
	g_tsHolux.pfHasPhone       = RgnPredicateTrue;
	g_tsHolux.pfHasContact     = RgnPredicateFalse;
	g_tsHolux.pfHasDescription = RgnPredicateFalse;

	g_tsHolux.dwFeatures       = 0;

	g_tsHolux.cMaxBits         = 24;
}

static
void DestroyHoluxTypes () {
	::DeleteObject (g_hpen43);
	::DeleteObject (g_hpen44);
	::DeleteObject (g_hpen45);
	::DeleteObject (g_hpen46);
	::DeleteObject (g_hpen46_2);
	::DeleteObject (g_hpen47);
	::DeleteObject (g_hpen48);
	::DeleteObject (g_hpen48_2);
}

///////////////////////////////////////////

bool IsHoluxPolygon  (BYTE _btHoluxType) {return _btHoluxType <= 3;}
bool IsHoluxPolyline (BYTE _btHoluxType) {return (4 <= _btHoluxType && _btHoluxType <= 6 ) || (43 <= _btHoluxType && _btHoluxType <= 51);}
bool IsHoluxPoint    (BYTE _btHoluxType) {return (7 <= _btHoluxType && _btHoluxType <= 42) || _btHoluxType == 255;}

///////////////////////////////////////////

void Holux2Garmin (BYTE _btHoluxType, RGN_KIND & rk, USHORT & ushType) {
	ushType = 0;
	switch (_btHoluxType) {
		case 0: // Living
			rk = rkPolygon; ushType = 0x01; break;
		case 1: // Water
			rk = rkPolygon; ushType = 0x46; break;
		case 2: // Green
			rk = rkPolygon; ushType = 0x50; break;
		case 3: // Other
			rk = rkPolygon; ushType = 0x00; break;

		case 4: // Wide road
			rk = rkPolyline; ushType = 0x01; break;
		case 5: // Middle road
			rk = rkPolyline; ushType = 0x02; break;
		case 6: // Narrow road
			rk = rkPolyline; ushType = 0x06; break;
		case 50: // Rail road
			rk = rkPolyline; ushType = 0x14; break;
		case 51: // Border
			rk = rkPolyline; ushType = 0x1e; break;

		case 7:  // Airport
			rk = rkPoint; ushType = 0x5900; break;
		case 8:  // Government
			rk = rkPoint; ushType = 0x3000; break;
		case 9:  // Gas station
			rk = rkPoint; ushType = 0x2f01; break;
		case 10: // Hotel
			rk = rkPoint; ushType = 0x2b00; break;
		case 11: // Medical
			rk = rkPoint; ushType = 0x3002; break;
		case 12: // Sport
			rk = rkPoint; ushType = 0x2c08; break;
		case 13: // Scenic
			rk = rkPoint; ushType = 0x5200; break;
		case 14: // Shop
			rk = rkPoint; ushType = 0x2e01; break;
		case 15: // Bank
			rk = rkPoint; ushType = 0x2f06; break;
		case 16: // School
			rk = rkPoint; ushType = 0x2c05; break;
		case 17: // Parking
			rk = rkPoint; ushType = 0x2f0b; break;
		case 18: // Station
			rk = rkPoint; ushType = 0x2f08; break;
		case 19: // Marina
			rk = rkPoint; ushType = 0x2f09; break;
		case 20: // Other
			rk = rkPoint; ushType = 0; break;
		case 22: // Dam
			rk = rkPoint; ushType = 0x5500; break;
		case 23: // Harbor
			rk = rkPoint; ushType = 0x650b; break;
		case 24: // Police
			rk = rkPoint; ushType = 0x3001; break;
		case 25: // Car
			rk = rkPoint; ushType = 0x2f03; break;
		case 26: // Restorant
			rk = rkPoint; ushType = 0x2a00; break;
		case 27: // Rail station
			rk = rkPoint; ushType = 0x2700; break;
		case 28: // Camp ground
			rk = rkPoint; ushType = 0x2b03; break;
		case 29: // Recreation
			rk = rkPoint; ushType = 0x2c01; break;
		case 30: // Park
			rk = rkPoint; ushType = 0x2c06; break;
		case 31: // Culture
			rk = rkPoint; ushType = 0x2c00; break;
		case 32: // Religion
			rk = rkPoint; ushType = 0x6404; break;
		case 33: // Building
			rk = rkPoint; ushType = 0x6402; break;
		case 34: // Monument
			rk = rkPoint; ushType = 0x2c04; break;
		case 35: // Cable car
			rk = rkPoint; ushType = 0x2f08; break;
		case 36: // Mountain pass
			rk = rkPoint; ushType = 0x6600; break;
		case 40: // Big city name
			rk = rkPoint; ushType = 0x0200; break;
		case 41: // Middle city name
			rk = rkPoint; ushType = 0x0400; break;
		case 42: // Small city name
			rk = rkPoint; ushType = 0x0500; break;
		case 255: // Way point
			rk = rkPoint; ushType = 0; break;

		case 43: // Mountain path
			rk = rkPolyline; ushType = 0x16; break;
		case 44: // New line styles
		case 45:
		case 46:
		case 47:
		case 48:
			rk = rkPolyline; ushType = 0x0; break;

		case 52: // Bike
			rk = rkPoint; ushType = 0; break;
		case 53: // Buoy
			rk = rkPoint; ushType = 0x1600; break; // Navaid
		case 54: // Fish
			rk = rkPoint; ushType = 0x4100; break; // Fishing hot spot
		case 55: // Horse
			rk = rkPoint; ushType = 0; break;
		case 56: // Man
			rk = rkPoint; ushType = 0; break;
		case 57: // Beacon
			rk = rkPoint; ushType = 0x160e; break; // Navaid, unknown
		case 58: // Anchorage
			rk = rkPoint; ushType = 0x4300; break; // Marina

		default:
			assert (false);
			rk = rkPoint; ushType = 0; break;
	}
}

///////////////////////////////////////////

struct hconv_t {
	WORD wGarminCodeFrom;
	WORD wGarminCodeTo;
	WORD wHoluxCode;
};

# pragma const_seg (".text")

const hconv_t g_convPolygons [] = {
	{0x01, 0x03, 0}, // Living

	{0x28, 0x29, 1}, // Water
	{0x32, 0x32, 1}, // Water
	{0x3b, 0x49, 1}, // Water
	{0x4c, 0x4c, 1}, // Water

	{0x50, 0x50, 2}, // Green
	{0x00, 0x00, 3}, // Other
};
const size_t c_cConvPolygons = sizeof (g_convPolygons)/sizeof (g_convPolygons [0]);

const hconv_t g_convPolylines [] = {
	{0x01, 0x01, 4},  // Wide road
	{0x02, 0x05, 5},  // Middle road
	{0x06, 0x0c, 6},  // Narrow road
	{0x16, 0x16, 6},  // Narrow road

	{0x14, 0x14, 50}, // Rail road

	{0x1c, 0x1e, 51}, // Border
};
const size_t c_cConvPolylines = sizeof (g_convPolylines)/sizeof (g_convPolylines [0]);

const hconv_t g_convPoints [] = {
	{0x5900, 0x593f, 7},  // Airport
	{0x2d0b, 0x2d0b, 7},  // Airport
	{0x2f04, 0x2f04, 7},  // Airport

	{0x3000, 0x3000, 8},  // Government
	{0x3004, 0x3004, 8},  // Government

	{0x2f01, 0x2f01, 9},  // Gas station
	{0x4400, 0x443f, 9},  // Gas station

	{0x2b00, 0x2b3f, 10}, // Hotel

	{0x3002, 0x3002, 11}, // Medical
	{0x4b00, 0x4b3f, 11}, // Medical
	{0x6408, 0x6408, 11}, // Medical

	{0x2c08, 0x2c08, 12}, // Sport
	{0x2d0a, 0x2d0a, 12}, // Sport

	{0x5200, 0x523f, 13}, // Scenic

	{0x2e00, 0x2e3f, 14}, // Shop

	{0x2f06, 0x2f06, 15}, // Bank

	{0x2c05, 0x2c05, 16}, // School
	{0x6410, 0x6410, 16}, // School

	{0x2f0b, 0x2f0b, 17}, // Parking
	{0x4d00, 0x4d3f, 17}, // Parking

	{0x2f08, 0x2f08, 18}, // Station

	{0x2f09, 0x2f09, 19}, // Marina
	{0x4300, 0x433f, 19}, // Marina
	{0x650b, 0x650b, 19}, // Marina

	{0,      0,      20}, // Other

	{0x5500, 0x553f, 22}, // Dam
	{0x6407, 0x6407, 22}, // Dam
	{0x6409, 0x6409, 22}, // Dam

//	{0x650b, 0x650b, 23}, // Harbor - Nature ?

	{0x3001, 0x3001, 24}, // Police

	{0x2f02, 0x2f03, 25}, // Car service
	{0x2f0d, 0x2f0e, 25}, // Car service

	{0x2a00, 0x2a3f, 26}, // Restorant
	{0x4500, 0x453f, 26}, // Restorant

//	{0x2700, 27}, // Rail station ??

	{0x2b03, 0x2b03, 28}, // Camp ground
	{0x4800, 0x483f, 28}, // Camp ground

	{0x2c01, 0x2c01, 29}, // Recreation
	{0x2d00, 0x2d09, 29}, // Recreation

	{0x2c06, 0x2c06, 30}, // Park
	{0x4900, 0x493f, 30}, // Park
	{0x640e, 0x640e, 30}, // Park

	{0x2c00, 0x2c00, 31}, // Culture
	{0x2c02, 0x2c03, 31}, // Culture

	{0x2c0b, 0x2c0b, 32}, // Religion
	{0x6404, 0x6404, 32}, // Religion

	{0x6402, 0x6402, 33}, // Building

	{0x2c04, 0x2c04, 34}, // Monument

	{0x0100, 0x0400, 40}, // Big city name
	{0x0500, 0x0700, 41}, // Middle city name
	{0x0800, 0x1100, 42}, // Small city name
};
const size_t c_cConvPoints = sizeof (g_convPoints)/sizeof (g_convPoints [0]);

# pragma const_seg ()

static
BYTE _Garmin2Holux (const hconv_t * _pConvTable, size_t _cTableItems, WORD _wGarminCode, WORD _wDefaultHoluxCode) {
	for (size_t c = 0; c < _cTableItems; ++ c) {
		assert (_pConvTable [c].wGarminCodeFrom <= _pConvTable [c].wGarminCodeTo);
		if (_pConvTable [c].wGarminCodeFrom <= _wGarminCode && _wGarminCode <= _pConvTable [c].wGarminCodeTo)
			return _pConvTable [c].wHoluxCode;
	}
	return _wDefaultHoluxCode;
}

BYTE Garmin2Holux (RGN_KIND _rk, USHORT _ushType) {
	switch (_rk) {
		case rkPoint:    return _Garmin2Holux (g_convPoints,    c_cConvPoints,    _ushType, 20);
		case rkPolyline: return _Garmin2Holux (g_convPolylines, c_cConvPolylines, _ushType, 6);
		case rkPolygon:  return _Garmin2Holux (g_convPolygons,  c_cConvPolygons,  _ushType, 0);
		default: assert (false); return 0;
	}
}

CTypeSet g_tsHolux (InitHoluxTypes, DestroyHoluxTypes);

/////////////////////////////////////////////////////////////////////

USHORT ConvertTypeSet_Garmin2Holux (RGN_KIND _Kind, USHORT _ushType) {
	return Garmin2Holux (_Kind, _ushType);
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Garmin2Holux, & g_tsGarmin, & g_tsHolux);

USHORT ConvertTypeSet_Navitel2Holux (RGN_KIND _Kind, USHORT _ushType) {
	const USHORT ushGarminType = ConvertTypeSet_Navitel2Garmin (_Kind, _ushType);
	return Garmin2Holux (_Kind, ushGarminType);
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Navitel2Holux, & g_tsNavitel, & g_tsHolux);

USHORT ConvertTypeSet_Russa2Holux (RGN_KIND _Kind, USHORT _ushType) {
	return ConvertTypeSet_Navitel2Holux (_Kind, _ushType);
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Russa2Holux, & g_tsRussa, & g_tsHolux);

USHORT ConvertTypeSet_Holux2Garmin (RGN_KIND _Kind, USHORT _ushType) {
	RGN_KIND rk = rkPoint;
	USHORT ushTypeGarmin = 0;
	Holux2Garmin (_ushType, rk, ushTypeGarmin);
	assert (rk == _Kind);
	return ushTypeGarmin;
}

DECLARE_TYPESET_CONVERTOR (ConvertTypeSet_Holux2Garmin, & g_tsHolux, & g_tsGarmin);